package com.example.healkep.MainActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.example.healkep.MainBg;
import com.example.healkep.FoodMainActivity;
import com.example.healkep.MainUser;
import com.example.healkep.R;

public class MainActivity2 extends Activity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate ( savedInstanceState );
        setContentView ( R.layout.activity_main_2 );
        //view层的控件和业务层的控件，靠id关联和映射  赋值，即设置布局文件中的Button按钮id进行关联
        Button select2 = (Button) findViewById ( R.id.select2 );
        Button select3 = (Button) findViewById ( R.id.select3 );
        Button select4 = (Button) findViewById ( R.id.select4 );
        Button main = (Button) findViewById ( R.id.mainchoose );
        Button food = (Button) findViewById ( R.id.food);
        Button sleep = (Button) findViewById ( R.id.sleep);
        Button sport = (Button) findViewById ( R.id.sports);


        //绑定监听事件
        select2.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 给bnt1添加点击响应事件
                    Intent intent2 = new Intent ( MainActivity2.this,FoodMainActivity.class );
                    //启动
                    startActivity ( intent2 );
            }
        } );

        select3.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 添加点击响应事件
                    Intent intent3 = new Intent ( MainActivity2.this, MainBg.class );
                    //启动
                    startActivity ( intent3 );
            }
        } );

        select4.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                    // 添加点击响应事件
                    Intent intent4 = new Intent ( MainActivity2.this, MainUser.class );
                    //启动
                    startActivity ( intent4 );
            }
        } );

        main.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent5 = new Intent ( MainActivity2.this, MainActivity.class );
                //启动
                startActivity ( intent5 );
            }
        } );

        food.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent6 = new Intent ( MainActivity2.this, MainActivityGetinFood.class );
                //启动
                startActivity ( intent6 );
            }
        } );

        sport.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent7 = new Intent ( MainActivity2.this, MainActivityGetinSports.class );
                //启动
                startActivity ( intent7 );
            }
        } );

        sleep.setOnClickListener ( new OnClickListener () {
            @Override
            public void onClick(View view) {
                // 添加点击响应事件
                Intent intent8 = new Intent ( MainActivity2.this, MainActivityGetinSleep.class );
                //启动
                startActivity ( intent8 );
            }
        } );
    }
}